﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jzy.Core.Common;
using FortuneHeavenCommon.DataMap;

namespace FortuneHeavenDAL
{
    public class GameShowOrdersDAL : BaseDAL
    {
        public List<GameShowOrders> GetShowOrders(int page, int size, int UserID)
        {
            if (page <= 0)
            {
                page = 1;
            }
            string sql = @"select * from (
select *
,ROW_NUMBER() OVER(ORDER BY ID DESC) ROW 
from GameShowOrders where UserID= @p0) FF
 WHERE FF.ROW BETWEEN  @p1 AND @p2";
            List<GameShowOrders> list = dbOper.Query<GameShowOrders>(sql, UserID, size * (page - 1) + 1, size * page);
            return list;
        }

        public int GetTotalSize(int UserID)
        {
            string sql = @"select count(id) from GameShowOrders where UserID=@p0";
            return dbOper.GetScalar<int>(sql,UserID);
        }
    }
}
